feat(mcptoolset): initiate interactive OAuth consent for MCP tools#1142
Draft
wolo-lab wants to merge 1 commit into
Draft
feat(mcptoolset): initiate interactive OAuth consent for MCP tools#1142wolo-lab wants to merge 1 commit into
wolo-lab wants to merge 1 commit into
Conversation
wolo-lab
force-pushed
the
wolo/auth-consent
branch
from
July 11, 2026 09:57
dcca456 to
75e4317
Compare
wolo-lab
force-pushed
the
wolo/auth-consent-gcp
branch
from
July 11, 2026 21:32
360105c to
ef4a912
Compare
wolo-lab
force-pushed
the
wolo/auth-consent
branch
from
July 11, 2026 21:46
75e4317 to
2ebe100
Compare
wolo-lab
force-pushed
the
wolo/auth-consent-gcp
branch
from
July 11, 2026 21:49
ef4a912 to
0675063
Compare
wolo-lab
force-pushed
the
wolo/auth-consent
branch
from
July 11, 2026 22:34
2ebe100 to
3ed5bbe
Compare
wolo-lab
force-pushed
the
wolo/auth-consent-gcp
branch
from
July 11, 2026 22:39
0675063 to
d68a62f
Compare
The generic adk_request_credential consent round-trip existed, but nothing triggered it for MCP: mcptoolset applies auth in the transport's RoundTripper, which cannot start a consent flow (it has no function call id), and the MCP SDK drops the underlying error chain — so a provider's auth.ConsentRequiredError never reached the tool through CallTool. Interactive (3-legged) OAuth for MCP tools therefore could not work. This wires the interactive path for MCP: - mcptoolset passes Config.Auth to each tool and, before calling the server, probes the provider. If it returns auth.ConsentRequiredError, the tool calls ctx.RequestCredential (pausing the run for consent) and returns the new tool.ErrCredentialRequired sentinel. On success the provider caches the credential, so the RoundTripper reuses it on the actual call — no extra network round-trip for the common (GCP) case. - A non-consent resolution error fails fast with the real cause (the RoundTripper would fail the same way on the call below, but the MCP SDK would mangle the error chain). - ctx.AuthResponse guards the resume: once the user has consented, a provider that still cannot mint a credential fails instead of looping. - tool.ErrCredentialRequired is the credential analog of ErrConfirmationRequired; retryandreflect skips it like the other HITL sentinels. - Config.Auth documents that interactive consent is driven only during tool execution; tool listing (Tools) cannot pause, so a server that authenticates listing needs a non-interactive or already-consented credential. Testing: go build ./..., go test -race -shuffle=on ./..., golangci-lint run, go mod tidy -diff — all green. New tests cover the consent request, proceed-after-consent, the no-loop guard, fail-fast on a non-consent error, and the no-provider path.
wolo-lab
force-pushed
the
wolo/auth-consent-gcp
branch
from
July 20, 2026 15:07
f66e8e0 to
3d28f93
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The generic adk_request_credential consent round-trip existed, but nothing
triggered it for MCP: mcptoolset applies auth in the transport's RoundTripper,
which cannot start a consent flow (it has no function call id), and the MCP SDK
drops the underlying error chain — so a provider's auth.ConsentRequiredError
never reached the tool through CallTool. Interactive (3-legged) OAuth for MCP
tools therefore could not work.
This wires the interactive path for MCP:
probes the provider. If it returns auth.ConsentRequiredError, the tool calls
ctx.RequestCredential (pausing the run for consent) and returns the new
tool.ErrCredentialRequired sentinel. On success the provider caches the
credential, so the RoundTripper reuses it on the actual call — no extra network
round-trip for the common (GCP) case.
would fail the same way on the call below, but the MCP SDK would mangle the
error chain).
that still cannot mint a credential fails instead of looping.
retryandreflect skips it like the other HITL sentinels.
execution; tool listing (Tools) cannot pause, so a server that authenticates
listing needs a non-interactive or already-consented credential.